{% extends '@Default/layout.twig' %}


{% block content %}

    <h2><i class="fa fa-folder-open right-padding-5"></i> Customer Users</h2>

    <h4>
        
    </h4>

	<div class="panel panel-white panel-animated">
	
		<div class="panel-body">
			<div class="panel-options">
		        <a class="btn btn-md btn-info" href="{{ app.urlFor('Customers-User-Create') }}">
		        	<i class="fa fa-plus-circle right-padding-5"></i> Add User
		        </a>
		        
		        <a href="{{ app.urlFor('AccessController-Customer-login') }}"
		        		class="btn btn-md btn-default" target="_blank">
		            <i class="fa fa-sign-in right-padding-5"></i> Customer Login
		        </a>
		    </div>
		
		    <table class="table" id="table">
		        <thead>
		            <tr>
		                <th>Name</th>
		                <th>Nickname</th>
		                <th>Username</th>
		                <th>Email</th>
		                <th>Options</th>
		            </tr>
		        </thead>
		        <tbody>
		            {% for obj in list %}
		
		                {% if obj.getUser() %}
		                    <tr>
		                        <td>{{ obj.getName() }}</td>
		                        <td>{{ obj.getNickname() }}</td>
		                        <td>{{ obj.getUser().getUsername() }}</td>
		                        <td>{{ obj.getEmail() }}</td>
		                        <td>
		                            <a class="btn btn-danger" href="{{ app.urlFor('Customers-User-Delete', {'id':obj.getId()}) }}">Delete</a>
		                        </td>
		                    </tr>
		                {% endif %}
		
		            {% endfor %}
		        </tbody>
		    </table>
		</div>
		
	</div>
    

    <script type="text/javascript">
        jQuery( document ).ready( function( $ ) {
            var $table = jQuery( "#table" );
            $table.DataTable( {
                dom: 'Bfrtip',
                buttons: [
                    'copy', 'csv', 'excel', {
                        extend: 'pdfHtml5',
                        title: 'List of Customers',
                        text: 'PDF'
                    }
                ]
            } );
        } );
    </script>

{% endblock %}